﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TaobaoPick.storage;
using TaobaoPick.util;
namespace TaobaoPick
{
    public class ErrorLogs
    {
        public static void logErrorURL(String url,String msg)
        {
            MyTaobao1DataContext context = LinqAgent.getTaobaoContext();
            ErrorUrl err = new ErrorUrl();

            err.id = NewGUID.create("erro");
            err.logTime = DateTime.Now;
            err.processrsult = null;
            err.processTime = null;
            err.url = url;
            context.ErrorUrls.InsertOnSubmit(err);
            context.SubmitChanges();
        }
        //------->
        public ErrorUrl pickOneUnProcessedError()
        {
            MyTaobao1DataContext context = LinqAgent.getTaobaoContext();
            ErrorUrl err = (from e in context.ErrorUrls where e.processrsult == null select e).SingleOrDefault();
            return err;
        }






    }
}
